clc;
nCount=0;
%Text=[2 2 3 0 1 2 3 4 1 2 0 1 2 3 4 1 2 3 4 1 2 4 5];
Text=[2 2 3 0 1 2 3 4 1 2 0 1 2 3 4 1 2 3 4 1 2 4];
Pattern=[1 2 3 4 1 2 4];
[orw_t,c_t]=size(Text);
[orw_p,c_p]=size(Pattern);
for m=1:c_t-c_p+1
    for n =1:c_p
        nCount = nCount+1;
        if Pattern(n)~=Text(m+n)
            break;
        end
        
        if n == c_p
            disp(num2str(m+1));
            %Text[m+1]
        end
    end
end
nCount

